/**
  ******************************************************************************
  * @file    hardware.h
  * @author  Thongnh
  * @version V1.0
  * @date    18-07-2011
  * @brief   Main process of USART
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, XICUTELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 Xicutelectronics</center></h2>
  ******************************************************************************
  */ 

#include "includes.h"

#ifndef __HARDWARE_H__
#define __HARDWARE_H__


#define BOARD_V1
//#define BOARD_V2

//#define TYPE_1_SENSOR
#define TYPE_2_SENSOR
//#define TYPE_3_SENSOR
//#define TYPE_4_SENSOR
//#define TYPE_5_SENSOR

#if defined ( BOARD_V1 )
    // define init cho sensor
    #define PERPH_CLOCK_CMD_SW      RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);   \
                                    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
    
    #define INIT_UP     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;       \
                        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;   \
                        GPIO_Init(GPIOA, &GPIO_InitStructure);
                        
    #define INIT_DOWN   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;      \
                        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;   \
                        GPIO_Init(GPIOC, &GPIO_InitStructure);
    
    
    // define input
    #define IN_UP      (((GPIOA->IDR)>>0)&0x01)
    #define IN_DOWN    (((GPIOC->IDR)>>13)&0x01)
    
    #define SW_ACTIVE       0
    #define SW_INACTIVE     1
#endif

#endif  //__HARDWARE_H__
// end of file

